/*
 * EntityManager.java
 *
 * Created on March 27, 2007, 2:42 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package ai9hells.pgaibe.chapter2.westworldwithmessaging;

import java.util.HashMap;
import java.util.Map;

/**
 *
 * @author andre.bandarra
 */
public class EntityManager {
    public static final EntityManager INSTANCE =  new EntityManager();
    private Map<Integer, BaseGameEntity> entityMap =
            new HashMap<Integer, BaseGameEntity>();
    /** Creates a new instance of EntityManager */
    private EntityManager() {
    }
    public void registerEntity(BaseGameEntity entity){
        entityMap.put(entity.getId(), entity);
    }
    public void removeEntity(BaseGameEntity entity){
        entityMap.remove(entity);
    }
    public BaseGameEntity getEntityFromId(int id){
        return entityMap.get(id);
    }
    
}
